﻿@model  WaiGaoQiaoWeb.Models.ArticleVM
@using WaiGaoQiaoWeb.Content.Extensions
@using System.Web.UI.WebControls
@{
    ViewBag.Title = "ArticleEdit";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section Head
{
    @Html.Css("form", "validationEngine")
    @Html.Js("form", "validate", "unobtrusive", "inlinevalidation")
    <script type="text/javascript">
        $(document).ready(function () {
            $("form").makeValidationInline();
            //保存
            $("#btnSave").click(function (event) {
                if ($("#ArticleName").val() == "") {
                    showErrorTip("请输入物品名称！", { left: 200, top: 2 }, true, 5000);
                    return false;
                }
                $('#GoodsEdit').ajaxSubmit(function (callback) {
                    if (callback) {
                        $(":input").each(function () {
                            if ($(this).attr("type") == "text" || $(this).attr("type") == "textarea") {
                                $(this).val("");
                            }
                        });
                        $("#ArticleNO").focus();
                        CloseModelWindow(null, true);
                    }
                    else {
                        showErrorTip("操作失败！", { left: 200, top: 2 }, true, 5000);
                    }
                });

            });
            //关闭
            $("#btnCancel").click(function (e) {
                $(":input").each(function () {
                    if ($(this).attr("type") == "text" || $(this).attr("type") == "textarea") {
                        $(this).val("");
                    }
                });
                $("#ArticleNO").focus();
                CloseModelWindow(null, false);
            });

        })
    </script>
}
<div style="padding: 5px;">
    @using (Html.BeginForm("SaveWork_Article", "Article", FormMethod.Post, new { id = "GoodsEdit" }))
    {
        @Html.ValidationSummary(true)
        <div class="mainpanel">
            <div style="height: 10px">
            </div>
            <div>
                @Html.LabelFor(model => model.ArticleNO):
                @Html.TextBoxFor(model => model.ArticleNO, new { @class = "" })
            </div>
            <div style="height: 10px">
            </div>
            <div>
                @Html.LabelFor(model => model.ArticleName):
                @Html.TextBoxFor(model => model.ArticleName, new { @class = "" }) <b style="color: Red">
                    *</b>
                @Html.ValidationMessageFor(model => model.ArticleName)
            </div>
            <div style="height: 10px">
            </div>
            <div>

                @Html.LabelFor(model => model.GetType):
                @Html.DropDownListFor(model => model.GetType,
                                   ViewBag.StorageType as IEnumerable<SelectListItem>,
                                   new { @style = "width:152px; height:22px; font-size:13px;" })
            </div>
             <div style="height: 10px">
            </div>
            <div>
                @Html.LabelFor(model => model.Color):
                @Html.TextBoxFor(model => model.Color, new { @class = "" })
            </div>
            <div style="height: 10px">
            </div>
            <div >
              <div  style="float:left;">    @Html.LabelFor(model => model.ArticleUnit):
              </div>
            
                @Html.CheckBoxListFor(model => model.UnitList,
      ViewData["UnitList"] as MultiSelectList,
                      @<div  style="float:left;">
                          @item.Button
                          @item.Text
                      </div>
                                , new { })
            </div>
           
            
        </div>
        @Html.HiddenFor(model => model.ID)
        @Html.HiddenFor(model => model.PriorId)
    }
    <div class="buttonpanel">
        <div style="float: right; margin-right: 10px;">
            <a id="btnSave" class="button" href="javascript:void(0);"><span>保存</span></a> <a
                id="btnCancel" class="button" href="javascript:void(0);"><span>关闭</span></a>
        </div>
    </div>
</div>
